package com.xx.pmis.services.implementations;

import java.util.List;

import com.xx.pmis.model.OtherExpense;
import com.xx.pmis.persistence.dao.OtherExpenseDAO;
import com.xx.pmis.services.OtherExpenseService;

public class OtherExpenseServiceImpl implements OtherExpenseService {
	OtherExpenseDAO otherExpenseDAO = null;

	public OtherExpenseServiceImpl(OtherExpenseDAO otherExpenseDAO) {
		super();
		this.otherExpenseDAO = otherExpenseDAO;
	}

	public void saveOrUpdateOtherExpense(OtherExpense otherExpense) throws Exception {
		otherExpenseDAO.saveOrUpdate(otherExpense);
	}

	public void saveOtherExpense(OtherExpense otherExpense) throws Exception {
		otherExpenseDAO.save(otherExpense);
	}

	public void deleteOtherExpense(OtherExpense otherExpense) throws Exception {
		otherExpenseDAO.delete(otherExpense);
	}

	public OtherExpense getOtherExpenseByOtherExpenseID(String OtherExpenseID) throws Exception {
		OtherExpense otherExpenses = otherExpenseDAO.getOtherExpenseByOtherExpenseID(OtherExpenseID);
		return otherExpenses;
	}

	public List<OtherExpense> getAllOtherExpenseByCondition(String sql) throws Exception {
		List<OtherExpense> otherExpenses = otherExpenseDAO.getAllOtherExpenseByCondition(sql);
		return otherExpenses;
	}

	public List<OtherExpense> getAllOtherExpenseByConditionByPage(String sql, int currentPage, int lineSize) throws Exception {
		List<OtherExpense> otherExpenses = otherExpenseDAO.getAllOtherExpenseByConditionByPage(sql, currentPage, lineSize);
		return otherExpenses;
	}

	public int getCountOfOtherExpenseByCondition(String sql) throws Exception {
		return otherExpenseDAO.getAllOtherExpenseByCondition(sql).size();
	}

}
